/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.cloudfarming.sensor.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import nl.cloudfarming.sensor.ParsedUnit;

/**
 * @author I. de Vries
 */
@Entity
@Table(name = "SensorRun")
public class SensorRunBO implements Serializable, ParsedUnit {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "SENSORRUN_ID")
    private long sensorRunId;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "geoDataFileId")
    private GeoSensorDataFileBO geoSensorDataFileBO;
    
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "plotId")
    private PlotBO plotBO;

    /**
     * For JPA use only.
     */
    @Deprecated
    protected SensorRunBO() {
    }

    public SensorRunBO(GeoSensorDataFileBO sensorDataFileBO, PlotBO plotBO) {
        this.geoSensorDataFileBO = sensorDataFileBO;
        this.plotBO = plotBO;
    }

    public long getSensorRunId() {
        return sensorRunId;
    }

    public GeoSensorDataFileBO getGeoSensorDataFileBO() {
        return geoSensorDataFileBO;
    }

    public void setGeoSensorDataFileBO(GeoSensorDataFileBO geoSensorDataFileBO) {
        this.geoSensorDataFileBO = geoSensorDataFileBO;
    }

    public PlotBO getPlotBO() {
        return plotBO;
    }

    public void setPlotBO(PlotBO plotBO) {
        this.plotBO = plotBO;
    }
}
